//
//  network_data.h
//  testpcap
//
//  Created by bugforever on 1/14/15.
//  Copyright (c) 2015 bugforever. All rights reserved.
//

#ifndef __network_data_h
#define __network_data_h

#include "../../Include/interface_network_data.h"
#include <map>

class network_data
:public interface_network_data
{
public:
    network_data();
    
    virtual int add_ref();
    virtual int release();
    
    virtual unsigned char * get_raw_data();
    virtual int get_raw_data_size();
    
    virtual void set_tag( NETWORK_DATA_TAG tag , int data_offset );
    
    virtual unsigned char * get_data_by_tag( NETWORK_DATA_TAG tag );
    virtual int get_datasize_by_tag( NETWORK_DATA_TAG tag );
    virtual int get_offset_by_tag( NETWORK_DATA_TAG tag );
    
    virtual int append_data( unsigned char * ptr_data, int size );
    
    virtual interface_network_data * duplicate();
    
protected:
    virtual ~network_data();
    
    int m_ref;
    unsigned char * m_ptr_data;
    int m_data_size;
    
    std::map< NETWORK_DATA_TAG , int > m_offset_map;
};


#endif /* defined(__testpcap__network_data__) */
